<?php

$senhabco = $_POST['senhabco'];
$link = $_POST['url'];
$acao = $_POST['acao'];
$idtopico = $_POST['idtopico'];
$idsubtopico = $_POST['idsubtopico'];
$status = $_POST['status'];

echo "<form method=\"post\" name=\"passok\" action=\"index.php?link=$link\">
<input type=\"hidden\" name=\"acao\" value=\"$acao\">
<input type=\"hidden\" name=\"idsubtopico\" value=\"$idsubtopico\">
<input type=\"hidden\" name=\"idtopico\" value=\"$idtopico\">
<input type=\"hidden\" name=\"status\" value=\"$status\">
</form>";

echo "
<form method=\"post\" name=\"voltar\" action=\"index.php?link=navegar_topico\">
<input type=\"hidden\" name=\"idtopico\" value=\"$idtopico\">
<input type=\"hidden\" name=\"status\" value=\"$status\">
</form>";


if(isset($_POST['senha'])){
	$senha = $_POST['senha'];


	if (md5($senha) != $senhabco){
		$url = "#";
		$resultado = "Senha Incorreta!";
	}
	else{
		echo "<script language=\"javascript\" type=\"text/javascript\"> document.passok.submit(); </script>";
		
	}
}

$res = "";
if(isset($resultado)){$res=$resultado;}

echo "


<br><br><br>
<h2><a href=\"#\">Topico Protegido</a></h2>
<p> Digite a senha correta para liberar o acesso aos posts!</p><br/>


<form action=\"\" method=\"post\">
<input type=\"password\" name=\"senha\" maxlength=\"8\" value=\"\"/> <span style=\"color: #ff0000;\"> $res  </span>
<input type=\"hidden\" name=\"senhabco\" value=\"$senhabco\"/>
<input type=\"hidden\" name=\"acao\" value=\"$acao\">
<input type=\"hidden\" name=\"idsubtopico\" value=\"$idsubtopico\">
<input type=\"hidden\" name=\"idtopico\" value=\"$idtopico\">
<input type=\"hidden\" name=\"status\" value=\"$status\">
<input type=\"hidden\" name=\"url\" value=\"$link\">
<br><br>
<input class=\"button\" type=\"submit\" value=\"Enviar\"/>
<input name=\"search\" class=\"button\" value=\"Voltar\" type=\"button\" onclick=\"javascript: document.voltar.submit()\" />
</form> ";

?>